/**
 * @name 时间工具类
 * @author qianShang
 * @version 20230906
 */
export default class TimeUtil {
    private static _Ins: TimeUtil;
    public static get Ins() {
        if (this._Ins == null) {
            this._Ins = new TimeUtil();
        }
        return this._Ins;
    }

    /**
     * 获取当前时间为周几
     */
    public GetDayOfWeek(){
        return new Date().getDay();
    }

    /**
     * 获取当前时间戳
     */
    public getTimestamp(): number {
        return new Date().getTime();
    }

    /**
     * 获取当前日期（年/月/日）
     */
    public getDate(): string {
        return new Date().toLocaleDateString();
    }

    /**
     * 获取当天指定时间的时间戳
     * @param hour 时
     * @param minute 分
     * @param second 秒
     * @example
     */
    public getTargetTimestamp(hour: number = 0, minute: number = 0, second: number = 0): number {
        const start = new Date(new Date().toLocaleDateString()).getTime();
        const target = ((hour * 3600) + (minute * 60) + second) * 1000;
        return new Date(start + target).getTime();
    }
}
